package com.basic.business.order.service.impl;

import com.basic.business.order.domain.TOrdersMerge;
import com.basic.business.order.mapper.TOrdersMergeMapper;
import org.springframework.stereotype.Service;
import com.basic.common.core.service.impl.BaseServiceImpl;
import com.basic.business.order.domain.TOrdersDetail;
import com.basic.business.order.service.ITOrdersDetailService;
import com.basic.business.order.mapper.TOrdersDetailMapper;

import javax.annotation.Resource;
import java.util.List;

/**
 * 业务-订单明细Service业务层处理
 *
 * @author zhaoxy_jn@163.com
 */
@Service
public class TOrdersDetailServiceImpl extends BaseServiceImpl<TOrdersDetailMapper,TOrdersDetail> implements ITOrdersDetailService {

    @Resource
    private TOrdersMergeMapper mergeMapper;

    @Override
    public List<TOrdersDetail> getList(TOrdersDetail po) {

        List<TOrdersDetail> list = super.getList(po);

        list.forEach(detail -> {
            TOrdersMerge merge = mergeMapper.getMergeByMergeSid(detail.getDetailSid());
            if (merge != null) {
                detail.setSellerMemo(merge.getSellerMemo());
                detail.setIsMergeMain(merge.getIsMergeMain());
            }
        });

        return list;
    }
}
